package doublePoint;

//双指针 吧数组中为0的元素原地移动到最后，并保持其他元素的顺序
public class QuestionTwo {

    public void moveZeroes(int[] nums) {
        int lowIndex = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0){
                nums[lowIndex++] = nums[i];
            }
        }
        for (int i = lowIndex;i< nums.length;i++){
            nums[i] = 0;
        }
    }
}
